Skip to content

Tony/701 web security key - #702

Closed
tonypioneer wants to merge 5 commits into
devfrom
tony/701_web_security_key
Closed

Tony/701 web security key#702
tonypioneer wants to merge 5 commits into
devfrom
tony/701_web_security_key

Conversation

@tonypioneer

Copy link
Copy Markdown
Collaborator

Pull Request Details

Description

Fixed the issue that the security key can be retrieved from web localStorage.

Related Issues

#701

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How To Test?

Run the app on web browser, and follow the instructions in #701

Checklist

  • Screenshots included here/in linked issue #
  • Changes adhere to the style and coding guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • Any dependent changes have been merged and published in downstream modules
  • The update contains no confidential information
  • The update has no duplicated content
  • No lint check errors are related to these changes (make prep or flutter analyze lib)
  • Integration test dart test output or screenshot included in issue #
  • I tested the PR on these devices:
    • Android
    • iOS
    • Linux
    • MacOS
    • Windows
    • Web
  • I have identified reviewers
  • The PR has been approved by reviewers

Finalising

  • Merge dev into the this branch
  • Resolve any conflicts
  • Add a one line summary into the CHANGELOG.md
  • Push to the git repository and review
  • Merge the PR into dev

@tonypioneer
tonypioneer requested a review from gjwgit August 11, 2026 10:25
@tonypioneer tonypioneer linked an issue Aug 12, 2026 that may be closed by this pull request
13 tasks
@tonypioneer
tonypioneer requested a review from cdawei August 12, 2026 00:56

@cdawei cdawei left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Tony, thanks for the PR.

I had some difficulty understanding the problem it solves:

  • If an attacker can access my browser's localStorage or a copy of it, it seems to imply my local computer is compromised.
  • If an attacker is able to use a live same-origin script to access my browser's localStorage, it seems to imply the web app that I am using is compromised.

Are these two scenarios in the scope of solidpod's security requirements?

// recovered offline. (A live same-origin XSS can still *use* — but not
// exfiltrate — the key; that is an inherent browser limitation, mitigated by
// CSP/XSS prevention, not storage.) The cache survives reloads, so the user
// is not forced to re-enter the key.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A live same-origin XSS can still use — but not exfiltrate — the key; that is an inherent browser limitation, mitigated by CSP/XSS prevention, not storage.

The comment is not particularly clear to me. Does the key here refer to the non-extractable AES-GCM key in IndexedDB? If so, does it imply a live same-origin script would still be able to use this AES-GCM key to get the user's security key?

The cache survives reloads, so the user is not forced to re-enter the key.

As a web app user, I actually expect to re-enter my security key after reloading/refreshing.

@cdawei

cdawei commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

Alternatives:

  • Use sessionStorage instead of localStorage in Flutter Secure Storage, see this line and the usage, or
  • Provide a wrapKey (where is the wrapKey stored -- RAM or session/localStorage? Needs to figure out...)

@tonypioneer

Copy link
Copy Markdown
Collaborator Author

Hi Tony, thanks for the PR.

I had some difficulty understanding the problem it solves:

  • If an attacker can access my browser's localStorage or a copy of it, it seems to imply my local computer is compromised.
  • If an attacker is able to use a live same-origin script to access my browser's localStorage, it seems to imply the web app that I am using is compromised.

Are these two scenarios in the scope of solidpod's security requirements?

Hi @cdawei, yes, this is a good point. If the browser's localStorage can be accessed by some other people remotely, that means the computer is compromised, and all security measures are futile. I think these two scenarios are at the boundary of SolidPod’s security requirements. They would be nice to have, but are not essential.

I think we could use sessionStorage instead of localStorage in Flutter Secure Storage as you mentioned above, and ask users to re-enter their security keys after reloading/refreshing. This will make things simpler. I'll implement it in another PR.

@tonypioneer

Copy link
Copy Markdown
Collaborator Author

Close this PR for now, and will submit a new PR after fixing this issue by using sessionStorage to save the security key for the web app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants